package stock.database;


import java.sql.Connection;
import java.sql.SQLException;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;

public class Coneccion {
	private Connection connection;
	Base base = new Base();

	public Connection getConnectionBase(){
		connection = base.getConnection();
		return connection;
	}
	  public Connection getConnectionDS(){
		   DataSource ds = null;
		   Context ic = null;
		      try{
		        ic = new InitialContext();
		        ds = (DataSource)ic.lookup("java:/comp/env/jdbc/dsInformeDeAvanceMasGroso");
		        return ds.getConnection();
		      }catch (SQLException e){
		        e.printStackTrace();
		        return null;
		      }catch(NamingException ne){
		        ne.printStackTrace();
		        return null;
		      }
		  }
}
